from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework.generics import ListAPIView
from .models import Category,Link
from .list_serializer import LinkSerializer,CategoryLinkSerializer


class ListView(ListAPIView):
    queryset = Link.objects.all()
    serializer_class = LinkSerializer

    def get(self, request):
        return self.list(request)


class CategoryLinkView(ListView):
    queryset = Category.objects.all()
    serializer_class = CategoryLinkSerializer

    def get(self, request):
        return self.list(request)